/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.uniminuto.edu.gimnasioInteligente.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author diegoalejandro
 */
@Entity
@Table(name = "rutina")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Rutina.findAll", query = "SELECT r FROM Rutina r"),
    @NamedQuery(name = "Rutina.findByIdRutina", query = "SELECT r FROM Rutina r WHERE r.idRutina = :idRutina"),
    @NamedQuery(name = "Rutina.findByDescripcion", query = "SELECT r FROM Rutina r WHERE r.descripcion = :descripcion"),
    @NamedQuery(name = "Rutina.findByDuraci\u00c3n", query = "SELECT r FROM Rutina r WHERE r.duraci\u00c3n = :duraci\u00c3n"),
    @NamedQuery(name = "Rutina.findByRegularidad", query = "SELECT r FROM Rutina r WHERE r.regularidad = :regularidad"),
    @NamedQuery(name = "Rutina.findBySeries", query = "SELECT r FROM Rutina r WHERE r.series = :series")})
public class Rutina implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idRutina")
    private Integer idRutina;
    @Size(max = 255)
    @Column(name = "descripcion")
    private String descripcion;
    @Size(max = 45)
    @Column(name = "duraci\u00c3\u00b3n")
    private String duraciÃn;
    @Size(max = 45)
    @Column(name = "regularidad")
    private String regularidad;
    @Size(max = 45)
    @Column(name = "series")
    private String series;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "rutinaidRutina")
    private Collection<PlanDeportista> planDeportistaCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "rutinaidRutina")
    private Collection<Ejercicio> ejercicioCollection;

    public Rutina() {
    }

    public Rutina(Integer idRutina) {
        this.idRutina = idRutina;
    }

    public Integer getIdRutina() {
        return idRutina;
    }

    public void setIdRutina(Integer idRutina) {
        this.idRutina = idRutina;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public String getDuraciÃn() {
        return duraciÃn;
    }

    public void setDuraciÃn(String duraciÃn) {
        this.duraciÃn = duraciÃn;
    }

    public String getRegularidad() {
        return regularidad;
    }

    public void setRegularidad(String regularidad) {
        this.regularidad = regularidad;
    }

    public String getSeries() {
        return series;
    }

    public void setSeries(String series) {
        this.series = series;
    }

    @XmlTransient
    public Collection<PlanDeportista> getPlanDeportistaCollection() {
        return planDeportistaCollection;
    }

    public void setPlanDeportistaCollection(Collection<PlanDeportista> planDeportistaCollection) {
        this.planDeportistaCollection = planDeportistaCollection;
    }

    @XmlTransient
    public Collection<Ejercicio> getEjercicioCollection() {
        return ejercicioCollection;
    }

    public void setEjercicioCollection(Collection<Ejercicio> ejercicioCollection) {
        this.ejercicioCollection = ejercicioCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idRutina != null ? idRutina.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Rutina)) {
            return false;
        }
        Rutina other = (Rutina) object;
        if ((this.idRutina == null && other.idRutina != null) || (this.idRutina != null && !this.idRutina.equals(other.idRutina))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "co.uniminuto.edu.gimnasioInteligente.entities.Rutina[ idRutina=" + idRutina + " ]";
    }
    
}
